package connector;

import java.sql.SQLException;
import java.util.ArrayList;

import database.relation.Table;

import junit.framework.Assert;
import junit.framework.TestCase;

public class ConnectionTest extends TestCase {

	protected void setUp() throws Exception {
		super.setUp();
	}

	public void testGetConnection() {
		try {
			java.sql.Connection con = Connection.getConnection("192.168.136.132", "1521", "orcl", "scott", "scott");
			Assert.assertNotNull(con);
		} catch (ClassNotFoundException e) {
			System.out.println(e);
		} catch (SQLException e) {
			System.out.println(e);
		}
	}

	public void testGetListRelation() {
		try {
			java.sql.Connection con = Connection.getConnection("192.168.136.132", "1521", "orcl", "scott", "scott");
			ArrayList<Table> result = Connection.getListRelation(con);
			Assert.assertEquals(4, result.size());
		} catch (ClassNotFoundException e) {
			System.out.println(e);
		} catch (SQLException e) {
			System.out.println(e);
		}
	}
	
}
